package com.smartum.mpr.dao;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.smartum.mpr.model.JobSubCategory;

@Repository
public class JobSubCategoryDao extends GenericDao<Long, JobSubCategory> {

	public List<JobSubCategory> getSubCategoriesByCategoryId(Long categoryID) {
		DetachedCriteria critteria = DetachedCriteria.forClass(JobSubCategory.class);
		critteria.createCriteria("category").add(Restrictions.eq("id", categoryID));
		return hibernateTemplate.findByCriteria(critteria);
	}

	@Override
	protected Class<JobSubCategory> getEntityClass() {
		return JobSubCategory.class;
	}

}
